package com.lottery.service;

import com.lottery.dao.MachineDao;
import com.lottery.pojo.TableMachines;
import com.lottery.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class MachineService {

    @Autowired
    private MachineDao machineDao;

    public void addOrUpdateMachine(String machine_number, String password) {
        String dt = DateUtils.getSub4DT();
        machineDao.addOrUpdateMachine(machine_number, password, UUID.randomUUID() + "", dt, dt);
    }

    public void deleteMachine(int id) {
        machineDao.deleteMachine(id);
    }

    public List<TableMachines> getMachines(String machineNumber) {
        return machineDao.getMachines(machineNumber);
    }

    public void updateMachineCommission(String machine_number, String commission) {
        machineDao.updateMachineCommission(machine_number, commission);
    }
}
